﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Motoball.screens;
using Motoball.Paddles;
using Microsoft.Xna.Framework.Input;

namespace Motoball.screenmanager
{
    public abstract class GameplayScreen : GameScreen
    {
        //public bool active = true;
       
        TimeSpan timer;
        protected int pointsPlayer1 = 0;
        protected int pointsPlayer2 = 0;
        DiffBloomModel ring;
        

        //stores which player selected which paddle
        int[] playerPaddles;
        public Paddle player1;
        public Paddle player2;

        public float innerRadius;

        public Ball ball;

        public float paddleDistance;

        public float outerGameRadius;

        public enum Activity
        {
            Waiting,
            Counting,
            Paused,
            Active,
            SpecialMovement
        }
        public Activity active = Activity.Waiting;

        public GameplayScreen(string screenName)
            : base(screenName)
        {
            playerPaddles = new int[2];
            playerPaddles[0] = 0;
            playerPaddles[1] = 0;
            player1 = new Paddle(Color.DarkBlue, this, 0);
            player2 = new Paddle(Color.Crimson, this, 1);
            player1.OtherPaddle = player2;
            player2.OtherPaddle = player1;
            ball = new Ball(Color.DarkBlue, this);
            
            player1.StartRotation = MathHelper.Pi;
            
            timer = new TimeSpan();
            
        }


        #region Methods
        /// <summary>
        /// handles escape-sequence in either active-mode oder while counting down
        /// </summary>
        /// <returns></returns>
        private bool HandleExit()
        {
            if (screenManager.Input.ExitGame)
            {
                PauseScreen pauseScreen = (PauseScreen)screenManager.GetScreen("pauseScreen");
                screenManager.AddScreen(pauseScreen);
                if (active == Activity.Counting)
                {
                    CountdownScreen countdown = (CountdownScreen)screenManager.GetScreen("countdownScreen");
                    countdown.active = false;
                }
                return true;
            }
            return false;
        }
        /// <summary>
        /// set players model and color
        /// </summary>
        /// <param name="playerIndex">corresponding player</param>
        /// <param name="paddleType">kind of paddle</param>
        /// <param name="color">paddle-color</param>
        public void SetPaddles(int playerIndex, int paddleType, Color color)
        {
            //memo:change code for more than 2 players
            playerPaddles[playerIndex] = paddleType;
            if (playerIndex == 0)
                player1.Color = color;
            else
                player2.Color = color;
        }
        /// <summary>
        /// set paddles- and ball-activity to given value
        /// </summary>
        /// <param name="active">true == active, false == inactive</param>
        public virtual void SetElementsActive(bool active)
        {
            ball.active = active;
            player1.active = active;
            player2.active = active;
            
        }
       
        /// <summary>
        /// calls paddle-updates; overwrite this method to update AI
        /// </summary>
        /// <param name="gameTime"></param>
        protected virtual void UpdatePaddles(GameTime gameTime)
        {
            player1.Update(gameTime);
            player2.Update(gameTime);
        }
        /// <summary>
        /// checks if a paddle hits the ball and if so ball is reflected;
        /// overwrite this method to change ball-reflection-behaviour/actions
        /// </summary>
        /// <param name="player">paddle collision shall be checked to</param>
        /// <returns>returns true if ball is reflected, false otherwise</returns>
        protected virtual bool BallToPaddleHandling(Paddle player)
        {
            
            //if player1 set playerFlag to false
            bool playerFlag = player.PlayerIndex != 0;
            if (Vector3.Distance(player.World.Translation, ball.Position) <
                        player.MaxPaddleDistance && (ball.PlayerFlag == playerFlag))
            {
                ball.Reflect(player);
                ball.Speed += 0.5f;
                player.paddleContent.ballHit = true;
                
                SetRadius();
                return true;
            }
            return false;
        }
        protected string prefix = "Obj_000";
        protected string currentBloomTest = "";
        protected int currentBloomNumber = 1;
        float continuous = 0;
        bool ballUp = false;
        public override void Update(GameTime gameTime)
        {
            //float time = (float)gameTime.ElapsedGameTime.TotalSeconds;
            //continuous += time;
            //ring.World *= Matrix.CreateRotationY(time);
            //player1.paddleContent.animation.Update(gameTime, continuous*5);
#if DEBUG
            if (screenManager.Input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.I))
            {
                ring.bloomingMeshes[currentBloomTest] = "default";
                if (++currentBloomNumber < 10)
                    currentBloomTest = prefix + "00" + currentBloomNumber.ToString();
                else if (currentBloomNumber < 100)
                    currentBloomTest = prefix + "0" + currentBloomNumber.ToString();
                else
                    currentBloomTest = prefix + currentBloomNumber.ToString();
                ring.bloomingMeshes[currentBloomTest] = "defaultBloom";
            }

            if (screenManager.Input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.O))
            {
                if (currentBloomNumber != 0)
                {

                    ring.bloomingMeshes[currentBloomTest] = "default";
                    if (--currentBloomNumber < 100)
                        currentBloomTest = prefix + "0" + currentBloomNumber.ToString();
                    else
                        currentBloomTest = prefix + currentBloomNumber.ToString();
                    ring.bloomingMeshes[currentBloomTest] = "defaultBloom";
                }
            }
#endif
            #region ScreenHandling
            timer += gameTime.ElapsedGameTime;

            switch (active)
            {
                case Activity.Active:
                    //if pause pressed
                    if (HandleExit())
                    {
                        active = Activity.Paused;
                        SetElementsActive(false);
                        return;
                    }
                    break;
                case Activity.Counting:
                    if (HandleExit())
                    {
                        active = Activity.Paused;
                        SetElementsActive(false);
                    }
                    return;
                case Activity.Waiting:
                    if (timer.TotalSeconds >= 1.5f)
                        StartGame(true);
                    return;
                case Activity.Paused:
                    return;
                case Activity.SpecialMovement:
                    player1.paddleContent.Update(gameTime);
                    player1.Draw(gameTime);
                    player2.paddleContent.Update(gameTime);
                    player2.Draw(gameTime);

                    ball.Draw(gameTime);
                    return;
                default:
                    return;
            }
            #endregion
            #region Updates
            UpdatePaddles(gameTime);
            //if (screenManager.Input.IsNewKeyPress(Keys.K))
            //    ballUp = !ballUp;
            //if(ballUp)
                ball.Update(gameTime);

            #endregion
            #region PaddleToPaddleCollision
            if (player1.Distance(player2) <= paddleDistance)
            {
                float tempDelta = player1.Delta;
                float tempDelta2 = player2.Delta;
                
                float diffDelta = MathHelper.Distance(tempDelta, tempDelta2) * 12f;
                if (IsLeftInCircle(tempDelta, tempDelta2))
                {
                    screenManager.Input.RumblePad(0, diffDelta / 2f, diffDelta);
                    screenManager.Input.RumblePad(1, diffDelta, diffDelta / 2f);
                }
                else
                {
                    screenManager.Input.RumblePad(0, diffDelta, diffDelta / 2f);
                    screenManager.Input.RumblePad(1, diffDelta / 2f, diffDelta);
                }
                

                bool p1Weight = player1.paddleContent.weight > PaddleContent.defaultWeight;
                bool p2Weight = player2.paddleContent.weight > PaddleContent.defaultWeight;
                if (p1Weight != p2Weight)
                {
                    float diff = CalcCenter(tempDelta, tempDelta2);
                    if (p1Weight)
                    {
                        player1.Delta = player2.Delta * player2.paddleContent.weight / player1.paddleContent.weight;
                        if (SameDirection(tempDelta, tempDelta2))
                        {
                            if (Bla(diff, tempDelta2))
                                player2.Delta = tempDelta * player1.paddleContent.weight / player2.paddleContent.weight;
                            else
                                player2.Delta = -diff * player2.friction;
                        }
                        else
                        {
                            player2.Delta = -player1.Delta * player1.paddleContent.weight * 2;
                        }
                    }
                    else
                    {
                        player2.Delta = tempDelta * player1.paddleContent.weight / player2.paddleContent.weight;
                        if(SameDirection(tempDelta2, tempDelta))
                        {
                            if(Bla(diff, tempDelta))
                                player1.Delta = tempDelta2 * player2.paddleContent.weight / player1.paddleContent.weight;
                            else
                                player1.Delta = -diff * player1.friction;
                        }
                        else
                            player1.Delta = -player2.Delta * player2.paddleContent.weight * 2;
                    }
                }
                else
                {
                    player1.Delta = player2.Delta * player2.paddleContent.weight / player1.paddleContent.weight;
                    player2.Delta = tempDelta * player1.paddleContent.weight / player2.paddleContent.weight;
                }

                //if other paddle was not rammed away pretty much the power will reflect



                ////move paddles a bit so they don't get stuck in each other
                player1.Rotation += player1.Delta * 2f;
                player2.Rotation += player2.Delta * 2f;
                AudioManager.PlayCue("paddle_hit_new");
                
            }

            #endregion
            #region CollisionPaddleToBall
            //check if ball is in range to hit a paddle
            float distance = Vector3.Distance(ball.Position, Vector3.Zero);
            if (distance >= innerRadius)
            {
                if (distance < outerGameRadius)
                {
                    BallToPaddleHandling(player1);
                    BallToPaddleHandling(player2);
                }
            #endregion
                #region BallOutHandling
                //if ball is out
                else if (Vector3.Distance(ball.Position, Vector3.Zero) >= outerGameRadius + 200f)
                {
                    AudioManager.PlayCue("ball_out_new");
                    if (ball.PlayerFlag)
                    {
                        pointsPlayer1++;
                        if (pointsPlayer1 == ScoreLimit)
                        {
                            EnterWinningScreen(player1);
                            return;
                        }
                        else
                            StartGame(false);
                    }
                    else
                    {
                        pointsPlayer2++;
                        if (pointsPlayer2 == ScoreLimit)
                        {
                            EnterWinningScreen(player2);
                            return;
                        }
                        else
                            StartGame(false);
                    }
                }
                #endregion
            }
        }
        private bool IsLeftInCircle(float radiansObjectOne, float radiansObjectTwo)
        {
            if(radiansObjectOne < 0f)
                radiansObjectOne -= MathHelper.TwoPi;
            if(radiansObjectTwo < 0f)
                radiansObjectTwo -= MathHelper.TwoPi;

            if((radiansObjectOne <= MathHelper.Pi && radiansObjectTwo <= MathHelper.Pi)
                || (radiansObjectOne >= MathHelper.Pi && radiansObjectTwo >= MathHelper.Pi))
                return radiansObjectOne < radiansObjectTwo;
            else if(radiansObjectOne <= MathHelper.Pi && radiansObjectTwo > MathHelper.Pi)
                return radiansObjectOne < (radiansObjectTwo - MathHelper.Pi);
            else
                return (radiansObjectOne - MathHelper.Pi) < radiansObjectTwo;
        }
        private bool SameDirection(float value1, float value2)
        {
            if(value1 == 0 || value2 == 0)
                return true;
            if (value1 < -0.00001f)
            {
                if(value2 < 0.00001f)
                    return true;
                else
                    return false;
            }
            else
            {
                if(value2 > -0.00001f)
                    return true;
                else
                    return false;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="value1"></param>
        /// <param name="value2"></param>
        /// <returns>returns true if value1 is bigger than value2</returns>
        private bool Bla(float value1, float value2)
        {
            if (value1 == 0)
                return false;
            else if (value2 == 0)
                return true;
            else if (value1 < 0f && value2 < 0f)
            {
                return (value1 < value2);
            }
            else if (value1 > 0f && value2 > 0f)
            {
                return (value1 > value2);
            }
            else
            {
                return (Bla(-value1, value2));
            }
        }
        
        public float CalcCenter(float value1, float value2)
        {
            float difference;
            if (value1 < 0f && value2 < 0f)
            {
                if(value1 < value2)
                    difference = value1 - value2;
                else
                    difference = value2 - value1;
            }
            else if(value1 > 0f && value2 > 0f)
            {
                if (value2 > value1)
                    difference = value2 - value1;
                else
                    difference = value1 - value2;
            }
            else
            {
                difference = value1 + value2;
            }
            return difference;
        }
        private void EnterWinningScreen(Paddle winner)
        {
            active = Activity.Paused;
            SetElementsActive(false);
            WinningScreen winningScreen = (WinningScreen)screenManager.GetScreen("winningScreen");
            screenManager.AddScreen(winningScreen);
            winningScreen.Enter(winner);
        }
        string[,] leftEnergyInterfaces;
        string[,] rightEnergyInterfaces;
        /// <summary>
        /// loads ring and ball
        /// </summary>
        public override void LoadContent()
        {
            ContentManager content = screenManager.Content;
            ring = new DiffBloomModel(content.Load<Model>("Models\\Ring_Pre"));
            ring.World = Matrix.CreateRotationX(MathHelper.PiOver2);
            string helper = "Obj_000";
            leftEnergyInterfaces = new string[2,7];
            leftEnergyInterfaces[0, 0] = helper + "104";
            leftEnergyInterfaces[0, 1] = helper + "070";
            leftEnergyInterfaces[0, 2] = helper + "074";
            leftEnergyInterfaces[0, 3] = helper + "075";
            leftEnergyInterfaces[0, 4] = helper + "077";
            leftEnergyInterfaces[0, 5] = helper + "087";
            leftEnergyInterfaces[0, 6] = helper + "099";

            leftEnergyInterfaces[1, 0] = helper + "060";
            leftEnergyInterfaces[1, 1] = helper + "062";
            leftEnergyInterfaces[1, 2] = helper + "065";
            leftEnergyInterfaces[1, 3] = helper + "066";
            leftEnergyInterfaces[1, 4] = helper + "109";
            leftEnergyInterfaces[1, 5] = helper + "064";
            leftEnergyInterfaces[1, 6] = helper + "063";

            rightEnergyInterfaces = new string[2,7];
            rightEnergyInterfaces[0, 0] = helper + "162";
            rightEnergyInterfaces[0, 1] = helper + "130";
            rightEnergyInterfaces[0, 2] = helper + "119";
            rightEnergyInterfaces[0, 3] = helper + "147";
            rightEnergyInterfaces[0, 4] = helper + "164";
            rightEnergyInterfaces[0, 5] = helper + "150";
            rightEnergyInterfaces[0, 6] = helper + "149";

            rightEnergyInterfaces[1, 0] = helper + "059";
            rightEnergyInterfaces[1, 1] = helper + "148";
            rightEnergyInterfaces[1, 2] = helper + "131";
            rightEnergyInterfaces[1, 3] = helper + "133";
            rightEnergyInterfaces[1, 4] = helper + "163";
            rightEnergyInterfaces[1, 5] = helper + "137";
            rightEnergyInterfaces[1, 6] = helper + "128";

            
            
            //ring.drawSetId = "foreground";
            //memo: don't load any paddle-content here because of paddle-selection
            ball.LoadContent(content);

            /*
            pointModels = new BasicModel[10];
            for (int i = 0; i < 10; i++)
                pointModels[i] = new BasicModel(content.Load<Model>("Models\\digit_" + i.ToString()));
            pointModelP1Left = pointModelP1Right = pointModelP2Left = pointModelP2Right = pointModels[0];
            pointModelP1PositionRight = Matrix.CreateTranslation(new Vector3(-40.0f, 0.0f, 40.0f));
            pointModelP2PositionRight = Matrix.CreateTranslation(new Vector3(40.0f, 0.0f, 40.0f));
            pointModelP1PositionLeft = pointModelP1PositionRight * Matrix.CreateTranslation(new Vector3(-5.0f, 0.0f, 0.0f));
            pointModelP2PositionLeft = pointModelP2PositionRight * Matrix.CreateTranslation(new Vector3(-5.0f, 0.0f, 0.0f));
            pointModelP1Right.World = pointModelP1PositionRight;
            pointModelP1Left.World = pointModelP1PositionLeft;
            pointModelP2Right.World = pointModelP2PositionRight;
            pointModelP2Left.World = pointModelP2PositionLeft;

            countdownScreen = new CountdownScreen("countdown", this);
            winningScreen = new WinningScreen("winning", this);
            pauseScreen = new PauseScreen("pause", this);

            countdownScreen.LoadContent();
            winningScreen.LoadContent();
            pauseScreen.LoadContent();
             * */
        }
        private void SetRadius()
        {
            float padSize;
            if (!ball.PlayerFlag)
                padSize = player1.BallHeight;
            else
                padSize = player2.BallHeight;

            innerRadius = padSize;
            outerGameRadius = innerRadius + 200;
        }
        //public void ChargeUp(int playerIndex, int itemLoading)
        //{
        //    if (itemLoading > player1.maxEnergy)
        //    {
        //        if (playerIndex == 0)
        //        {
        //            ring.bloomingMeshes[leftEnergyInterfaces[1, player1.maxEnergy-1]] = "defaultBloom";
        //        }
        //        else
        //        {
        //            ring.bloomingMeshes[rightEnergyInterfaces[1, player2.maxEnergy - 1]] = "defaultBloom";
        //        }
        //        return;
        //    }
             
        //    if (playerIndex == 0)
        //    {
        //        for (int i = 0; i < 7; i++)
        //        {
        //            if (i < itemLoading)
        //                ring.bloomingMeshes[leftEnergyInterfaces[1, i]] = "defaultBloom";
        //            else
        //                ring.bloomingMeshes[leftEnergyInterfaces[1, i]] = "default";
        //        }
        //        ring.bloomingMeshes[leftEnergyInterfaces[1, itemLoading - 1]] = "chargeBloom0";
        //        ring.bloomingMeshes[leftEnergyInterfaces[0, itemLoading - 1]] = "chargeBloom0";
        //    }
        //    else
        //    {

        //        for (int i = 0; i < 7; i++)
        //        {
        //            if (i < itemLoading)
        //                ring.bloomingMeshes[rightEnergyInterfaces[1, i]] = "defaultBloom";
        //            else
        //                ring.bloomingMeshes[rightEnergyInterfaces[1, i]] = "default";
        //        }
        //        ring.bloomingMeshes[rightEnergyInterfaces[1, itemLoading - 1]] = "chargeBloom1";
        //        ring.bloomingMeshes[rightEnergyInterfaces[0, itemLoading - 1]] = "chargeBloom1";
        //    }
        //}
        public void ChangeEnergy(int playerIndex, int newValue)
        {
            if (playerIndex == 0)
            {
                for (int i = 0; i < 7; i++)
                {
                    if (i < newValue)
                        ring.bloomingMeshes[leftEnergyInterfaces[0, i]] = "defaultBloom";
                    else
                        ring.bloomingMeshes[leftEnergyInterfaces[0, i]] = "default";
                }
            }
            else
            {
                
                for (int i = 0; i < 7; i++)
                {
                    if (i < newValue)
                        ring.bloomingMeshes[rightEnergyInterfaces[0, i]] = "defaultBloom";
                    else
                        ring.bloomingMeshes[rightEnergyInterfaces[0, i]] = "default";
                }
            }
        }

        Color fontCol1;
        Color fontCol2;
        /// <summary>
        /// called at screen-entering, loads paddles and initializes some variables
        /// </summary>
        public override void SetToActive()
        {
            fontCol1 = calcFontCol(0);
            fontCol2 = calcFontCol(1);

            for(int i=0; i<7; i++)
            {
                foreach (BasicEffect be in ring.model.Meshes[leftEnergyInterfaces[0, i]].Effects)
                    be.SpecularColor = be.EmissiveColor = player1.Col3 * 2f;
                foreach (BasicEffect be in ring.model.Meshes[rightEnergyInterfaces[0, i]].Effects)
                    be.SpecularColor = player2.Col3 * 2f;
            }
            
            
            
            active = Activity.Waiting;

            player1.LoadContent(screenManager.Content, playerPaddles[0]);
            player2.LoadContent(screenManager.Content, playerPaddles[1]);
            
            paddleDistance = player1.PaddleWidth + player2.PaddleWidth;
            
            //memo: TODO: load background depending on ringsize
            //currentringsize + half-ball-size
            SetRadius();
            

            //start cam-movement
            CameraMovementScreen camScreen = (CameraMovementScreen)screenManager.GetScreen("cameraMovementScreen");
            camScreen.StartCameraMovement(Camera.menuView, Camera.gameplayView);
            screenManager.AddScreen(screenManager.GetScreen("cameraMovementScreen"));

        }

        /// <summary>
        /// calculates point-font-color depending on player colors (font-col is maybe brighter to ensure
        /// better visibility)
        /// </summary>
        /// <param name="playerIndex">player color is correspoding to</param>
        /// <returns>font-color</returns>
        private Color calcFontCol(int playerIndex)
        {
            Paddle colPlayer;
            if (playerIndex == 0)
                colPlayer = player1;
            else
                colPlayer = player2;

            float length = colPlayer.Col3.Length();
            float multiplier = 1f;
            if (length < 0.7f)
                multiplier = 1.4f;

            Color color = new Color(colPlayer.Col3.X * multiplier, colPlayer.Col3.Y * multiplier,
                colPlayer.Col3.Z * multiplier);

            return color;
        }

        public override void Draw(GameTime gameTime)
        {
            //float debug = ball.Position.X;
            //float debug2 = ball.Position.Y;
            //float debug3 = ball.Position.Z;
            //screenManager.AddDebugString(debug.ToString());
            //screenManager.AddDebugString(debug2.ToString());
            //screenManager.AddDebugString(debug3.ToString());

            screenManager.AddDebugString(currentBloomTest);
            ring.Draw(Camera);
            ball.Draw(gameTime);
            player1.Draw(gameTime);
            player2.Draw(gameTime);
            
            //draw points
        
            //SpriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None, Matrix.CreateScale(5f));

            //float offsetX = 20f;
            //float offsetY = 20f;
            //SpriteBatch.DrawString(screenManager.debugFont, pointsPlayer1.ToString(), new Vector2(offsetX, offsetY), fontCol1);
            //SpriteBatch.DrawString(screenManager.debugFont, pointsPlayer2.ToString(),
            //    new Vector2(ContentStorage.screenWidth / 5 - offsetX, offsetY), fontCol2);
            //SpriteBatch.End();
            
            //pointModelP1Right.Draw(Camera);
            //pointModelP1Left.Draw(Camera);
            //pointModelP2Right.Draw(Camera);
            //pointModelP2Left.Draw(Camera);
        }
    
        public Paddle GetPlayer(int playerIndex)
        {
            if (playerIndex == 1)
                return player1;
            else if (playerIndex == 2)
                return player2;
            else
                return null;
        }

        /// <summary>
        /// reset screen totally including points
        /// </summary>
        public override void Reset()
        {
            ResetPositions();
            PointsPlayer1 = 0;
            PointsPlayer2 = 0;
            timer = TimeSpan.Zero;
        }

        /// <summary>
        /// resets paddles, ball and bloom-intensity
        /// </summary>
        public void ResetPositions()
        {
            string name = ScreenName;
            player1.Reset();
            //memo: check if aiplayer.reset is called or paddle.reset, if last one: overwrite ResetPositions
            //in sp-screen
            player2.Reset();
            //if player 2 hit the ball last
            if (ball.PlayerFlag)
                ball.Reset(player2.StartRotation);

            else
                ball.Reset(player1.StartRotation);

            SetElementsActive(true);
        }
        
        /// <summary>
        /// calls ResetPostions and gets ready to start countdown
        /// </summary>
        /// <param name="newGame"></param>
        public void StartGame(bool newGame)
        {
            //base.Exit();
            timer = new TimeSpan();
            active = Activity.Counting;
            SetElementsActive(false);
            if (newGame)
            {                
                
                //memo:for debug
                //active = true;
                
                //start a new countdown - 1 second done for we don't need
                //to display gameplay screen without countdown
                CountdownScreen countdownScreen = (CountdownScreen)screenManager.GetScreen("countdownScreen");
                countdownScreen.StartCountdown(new TimeSpan(0, 0, 1));
            }
            else
            {
                //start countdown at zero
                CountdownScreen countdownScreen = (CountdownScreen)screenManager.GetScreen("countdownScreen");
                countdownScreen.StartCountdown(TimeSpan.Zero);
            }
        }
        #endregion

        #region Properties
       
        
        public int ScoreLimit
        {
            get { return ContentStorage.ScoreLimit; }
        }
        private int PointsPlayer1
        {
            get { return pointsPlayer1; }
            set
            {
                //calculate first and second digit
                pointsPlayer1 = value;
                //pointModelP1Left = pointModels[pointsPlayer1 / 10];
                //pointModelP1Right = pointModels[pointsPlayer1 - pointsPlayer1 / 10];
                //pointModelP1Left.World = pointModelP1PositionLeft;
                //pointModelP1Left.World = pointModelP1PositionLeft;
            }
        }
        private int PointsPlayer2
        {
            get { return pointsPlayer2; }
            set
            {
                //calculate first and second digit
                pointsPlayer2 = value;
                //pointModelP1Left = pointModels[pointsPlayer1 / 10];
                //pointModelP1Right = pointModels[pointsPlayer1 - pointsPlayer1 / 10];
                //pointModelP1Left.World = pointModelP1PositionLeft;
                //pointModelP1Left.World = pointModelP1PositionLeft;
            }
        }
        #endregion
 
    }
}
